﻿using System;

namespace EditoneLib
{
    public class StereoTrack : BaseAudioTrack<StereoAudioClip>
    {
        private float _balance;

        public StereoTrack()
            : base()
        {
        }
        
        public float Balance
        {
            get { return _balance; }
            set
            {
                _balance = value;
                OnPropertyChanged();
            }
        }

        public override int NumChannels
        {
            get { return 2; }
        }

        public override void MapDefault(ChannelMapping mapping)
        {
            mapping.Map(this, 0, 1, Math.Min(Balance + 1.0f, 1.0f) * Volume);
            mapping.Map(this, 1, 2, Math.Min(Balance - 1.0f, 1.0f)*Volume );
        }

        public override Type[] SupportedClipTypes
        {
            get
            {
                return new[]
                {
                    typeof (StereoAudioClip)
                };
            }
        }
    }
}